<?php
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        $filePath    = "result.txt";
        $fileHandler = fopen($filePath, "w");

        fwrite($fileHandler,date("Y-m-d H:i:s") . " results:\n\n");

        foreach ($_POST as $k => $v) {
                fwrite($fileHandler, $k . ":\t" . $v . "\n");
        }
        fclose($fileHandler);
    }
?>